{% extends "admin/base_site.html" %}
{% load i18n %}
{% load adminmedia %}

{% block extrahead %}
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/core.js"></script>
<script type="text/javascript" src="{% admin_media_prefix %}js/admin/CollapsedFieldsets.js"></script>
{% endblock %}
{% block coltype %}colM{% endblock %}
{% block bodyclass %}change-form{% endblock %}
{% block extrastyle %}
<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
<link rel="stylesheet" type="text/css" href="{{ settings_var.URL_FILEBROWSER_MEDIA }}css/filebrowser.css" />
{% if query.pop %}
<style type="text/css">
#header { display: none; }
</style>
{% endif %}
{% endblock %}
{% block breadcrumbs %}<div class="breadcrumbs">{{ breadcrumbs }}</div>{% endblock %}

{% block content %}
<div id="content-main">
    <form enctype="multipart/form-data" action="./?action=upload&amp;{{ query.pop }}" method="post" name="FileForm">
    {{ formset.management_form }}
    <div>
        <div class="submit-row">
            <input type="submit" value="Upload" class="default" />
        </div>
        {% if form.errors %}{{ form.errors }}{% endif %}
        
        {% for file_form in formset.forms %}
            <fieldset class="module aligned {% if forloop.counter0 %}collapse{% else %}{% endif %}">
                <h2>{% trans "File" %} {{ forloop.counter }}</h2>
                <div class="form-row">
                    <label for="id_{{ file_form.file.name }}"{% if file_form.file.required %} class="required"{% endif %}>{{ file_form.file.label }}</label>
                    {{ file_form.file }}
                    {{ file_form.file.errors }}
                </div>
                <div class="form-row">
                    <label for="id_{{ file_form.title.name }}"{% if file_form.title.required %} class="required"{% endif %}>{{ file_form.title.label }}</label>
                    {{ file_form.title }}
                    {{ file_form.title.errors }}
                </div>
                <div class="form-row">
                    <label for="id_{{ file_form.description.name }}"{% if file_form.description.required %} class="required"{% endif %}>{{ file_form.description.label }}</label>
                    {{ file_form.description }}
                    {{ file_form.description.errors }}
                </div>
            </fieldset>
        {% endfor %}        

        <fieldset class="module aligned collapse">
            <h2>{% trans "Upload Settings" %}</h2>
            <div class="form-row checkbox-row">
                {{ form.rename_to_timestamp }}
                <label for="id_{{ form.rename_to_timestamp.name }}" class="vCheckboxLabel">{{ form.rename_to_timestamp.label }}</label>
                {{ form.rename_to_timestamp.errors }}
            </div>
            <div class="form-row checkbox-row">
                {{ form.convert_to_lower_case }}
                <label for="id_{{ form.convert_to_lower_case.name }}" class="vCheckboxLabel">{{ form.convert_to_lower_case.label }}</label>
                {{ form.convert_to_lower_case.errors }}
            </div>
            <div class="form-row checkbox-row">
                {{ form.change_spaces_to_underscores }}
                <label for="id_{{ form.change_spaces_to_underscores.name }}" class="vCheckboxLabel">{{ form.change_spaces_to_underscores.label }}</label>
                {{ form.change_spaces_to_underscores.errors }}
            </div>
            <div class="form-row checkbox-row">
                {{ form.overwrite_existing }}
                <label for="id_{{ form.overwrite_existing.name }}" class="vCheckboxLabel">{{ form.overwrite_existing.label }}</label>
                {{ form.overwrite_existing.errors }}
            </div>
            <div class="form-row checkbox-row">
                {{ form.extract_archives }}
                <label for="id_{{ form.extract_archives.name }}" class="vCheckboxLabel">{{ form.extract_archives.label }}</label>
                {{ form.extract_archives.errors }}
            </div>
            <div class="form-row">
                <label for="id_{{ form.image_modifications.name }}"{% if form.image_modifications.required %} class="required"{% endif %}>{{ form.image_modifications.label }}</label>
                {{ form.image_modifications }}
                {{ form.image_modifications.errors }}
            </div>
        </fieldset>
        
        <fieldset class="module aligned collapse">
            <h2>{% trans "Help" %}</h2>
            <div class="form-row" >
                {% for extension in settings_var.EXTENSIONS.items %}
                {% ifnotequal extension.0 'Folder' %}
                <label class="required">{% if forloop.first %}{% trans "Allowed" %}:{% else %}&nbsp;{% endif %}</label> 
                <p>{{ extension.0|safe }} ({{ extension.1|join:", "|safe }})</p>
                {% endifnotequal %}
                {% endfor %}
            </div>
            <div class="form-row" >
                <label class="required">{% trans "Max. Filesize" %}:</label> 
                <p class="help">{{ settings_var.MAX_UPLOAD_SIZE|safe }}</p>
            </div>
        </fieldset>
        <div class="submit-row">
            <input type="submit" value="Upload" class="default" />
        </div>
    </div>
    </form>
    
</div>
{% endblock %}